package day7;

import java.util.*;

/**
 * 有效的括号数
 */

public class Parenthesis {
    public boolean chkParenthesis(String A, int n) {
        // write code here
        int count = 0;
        for (char c :A.toCharArray()) {
            if (c == '(' || c == ')'){
                count++;
            }else {
                return false;
            }
        }
        return count == n;
    }
}